'\"macro stdmacro
.\"
.\" Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
.\"
.\" This program is free software; you can redistribute it and/or modify it
.\" under the terms of the GNU General Public License as published by the
.\" Free Software Foundation; either version 2 of the License, or (at your
.\" option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful, but
.\" WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
.\" or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
.\" for more details.
.\"
.\"
.TH PMPARSECTIME 3 "PCP" "Performance Co-Pilot"
.SH NAME
\f3__pmParseCtime\f1 \- convert \fBctime\fR(3) string to \fBtm\fR structure
.SH "C SYNOPSIS"
.ft 3
.ad l
.hy 0
#include "pmapi.h"
.br
#include "libpcp.h"
.sp
int __pmParseCtime(const char *\fIstring\fP,
'in +\w'int __pmParseCtime('u
struct\ tm\ *\fIrslt\fP,
char\ **\fIerrmsg\fP);
.in
.sp
cc ... \-lpcp
.hy
.ad
.ft 1
.SH CAVEAT
This documentation is intended for internal Performance Co-Pilot
(PCP) developer use.
.PP
These interfaces are not part of the PCP APIs that are guaranteed to
remain fixed across releases, and they may not work, or may provide
different semantics at some point in the future.
.SH DESCRIPTION
.B __pmParseCtime
reverses the
.BR asctime (3)
function.  It accepts a
.B string
specifying a time, and fills in the given
.B tm
structure.
.PP
.I string
is either a fully specified date and time
in the format
.I "Day MMM DD HH:MM:SS YYYY"
(e.g "Mon Mar  4 13:07:47 1996")
or a partially specified date and time
like "1996", "Mar 1996", "Mar 4 1996", "Mar", "13:07:47", "13:07",
"Mar 4 13:07:47",....
For a partially specified date and time, the order of the fields must be preserved
and missing fields are filled in from the current date and time.
.PP
The seconds component (\c
.IR SS )
may be a floating point number, for example the time "13:07:47.5".  The 12 hour
clock is also supported, so "13:07" and "1:07 pm" are equivalent.
.PP
.B __pmParseCtime
returns 0 if successful.  It returns \-1 and a dynamically allocated
error message string in
.BR errmsg ,
if the given
.B string
does not parse.  Be sure to
.BR free (3)
the error message string.
.PP
The
.B tm
structure returned in
.B rslt
should only be used as an argument to either the
.B __pmtimevalConvert
function or the
.B __pmtimespecConvert
function, as it contains encoded information that will only be
correctly interpreted by these routines.
.SH SEE ALSO
.BR PMAPI (3),
.BR __pmtimespecConvert (3),
.BR __pmtimevalConvert (3),
.BR __pmtimespecParse (3)
.BR __pmtimevalParse (3)
and
.BR pmParseInterval (3).

.\" control lines for scripts/man-spell
.\" +ok+ asctime YYYY MMM DD HH SS
.\" +ok+ tm {from struct tm}
